package com.zccx.eth.utils;

import java.util.HashMap;
import java.util.Map;

public class SMSCodeCache {
    private static SMSCodeCache instance;
    private static Map<String,String> map = new HashMap<>();
    private SMSCodeCache(){}

    public static SMSCodeCache getInstance(){
        if(instance == null){
            instance = new SMSCodeCache();
        }
        return instance;
    }

    public void putCode(String phone,String code){
        map.put(phone,code);
    }

    public String getCode(String phone){
        return map.get(phone);
    }

    public void removeCode(String phone){
        map.remove(phone);
    }
}
